Imports Microsoft.VisualBasic

Public Class CLS_FCN
    '---------------------------------MD5------------------------------------
    Public Function MD5(ByVal s As String) As String
        Return (MD5(s, New System.Text.UnicodeEncoding))
    End Function

    Private Function MD5( _
                    ByVal s As String, _
                    ByVal enc As System.Text.Encoding) As String
        Dim _md5 As New System.Security.Cryptography.MD5CryptoServiceProvider
        Dim input(), output() As Byte
        Dim hash As New System.Text.StringBuilder(32)

        input = enc.GetBytes(s)
        output = _md5.ComputeHash(input)

        For Each b As Byte In output
            hash.Append(String.Format("{0:X2}", b))
        Next
        Return (hash.ToString)
    End Function

    Public Function ShowDate()
        Dim day As String = Now.Day
        Dim month As String = Now.Month
        If month.Length = 1 Then
            month = "0" & Now.Month
        Else
            month = Now.Month
        End If

        If day.Length = 1 Then
            day = "0" & Now.Day
        Else
            day = Now.Day
        End If
        Dim d As String = day & "/" & month & "/" & Now.Year
        Return d
    End Function
    Public Function GetDate()
        Dim day As String = Now.Day
        Dim month As String = Now.Month
        If month.Length = 1 Then
            month = "0" & Now.Month
        Else
            month = Now.Month
        End If

        If day.Length = 1 Then
            day = "0" & Now.Day
        Else
            day = Now.Day
        End If
        Dim d As String = Now.Year & "" & month & "" & day
        Return d
    End Function

    Public Function GetDate(ByVal DateValues As String)
        Dim d As String

        'If DateValues.Length = 8 Then
        '    d = DateValues.Substring(6, 4) + DateValues.Substring(3, 2) + DateValues.Substring(0, 2)
        'ElseIf DateValues.Length = 6 Then
        '    d = DateValues.Substring(6, 2) & "/" & DateValues.Substring(4, 2) & "/" & DateValues.Substring(0, 4)
        'End If
        If DateValues <> Nothing Then
            If DateValues.Length = 8 Then
                d = DateValues.Substring(6, 2) & "/" & DateValues.Substring(4, 2) & "/" & DateValues.Substring(0, 4)
            ElseIf DateValues.Length = 10 Then
                d = DateValues.Substring(6, 4) + DateValues.Substring(3, 2) + DateValues.Substring(0, 2)
            Else
                d = Nothing
            End If
        End If

        Return d
    End Function
End Class
